package com.ze.sys.excel;

import com.ze.sys.entity.SysUser;
import com.ze.sys.entity.req.PageSysUserReq;
import com.ze.sys.service.SysUserService;
import com.ze.tool.excel.BaseEasyExcelExport;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * 测试优化后的导出
 */
@Component
public class SysUserExcelExport2 extends BaseEasyExcelExport<PageSysUserReq, SysUser> {

    @Resource
    private SysUserService sysUserService;

    @Override
    protected Long dataTotalCount(PageSysUserReq conditions) {
        return sysUserService.queryByPage(conditions).getTotal();
    }

    @Override
    protected Long eachSheetTotalCount() {
        return 2L;
    }

    @Override
    protected List<SysUser> buildDataList(PageSysUserReq queryCondition, Long pageNo, Long pageSize) {
        queryCondition.setPageNo(pageNo);
        queryCondition.setPageSize(pageSize);
        return sysUserService.queryByPage(queryCondition).getResult();
    }

}
